﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using Tao.OpenGl;
using Tao.Platform.Windows;
using System.Diagnostics;

namespace TaoGL_UserControl
{
    class PianoKeyNormal:Tex2DUV
    {
        string[] ImgTable =
        {
            "type_01_normalbutton_001.tga","type_01_normalbutton_002.tga","type_01_normalbutton_003.tga","type_01_normalbutton_004.tga","type_01_normalbutton_005.tga",
            "type_01_normalbutton_006.tga","type_01_normalbutton_007.tga","type_01_normalbutton_008.tga","type_01_normalbutton_009.tga","type_01_normalbutton_010.tga",
            "type_01_normalbutton_011.tga","type_01_normalbutton_012.tga","type_01_normalbutton_013.tga","type_01_normalbutton_014.tga","type_01_normalbutton_015.tga",
            "type_01_normalbutton_016.tga","type_01_normalbutton_017.tga","type_01_normalbutton_018.tga","type_01_normalbutton_019.tga","type_01_normalbutton_020.tga",
            "type_01_normalbutton_021.tga","type_01_normalbutton_022.tga","type_01_normalbutton_023.tga","type_01_normalbutton_024.tga","type_01_normalbutton_025.tga",
            "type_01_normalbutton_026.tga","type_01_normalbutton_027.tga","type_01_normalbutton_028.tga","type_01_normalbutton_029.tga","type_01_normalbutton_030.tga",
            "type_01_normalbutton_031.tga","type_01_normalbutton_032.tga","type_01_normalbutton_033.tga","type_01_normalbutton_034.tga","type_01_normalbutton_035.tga",
            "type_01_normalbutton_036.tga","type_01_normalbutton_037.tga","type_01_normalbutton_038.tga","type_01_normalbutton_039.tga","type_01_normalbutton_040.tga",
            "type_01_normalbutton_041.tga","type_01_normalbutton_042.tga","type_01_normalbutton_043.tga","type_01_normalbutton_044.tga","type_01_normalbutton_045.tga",
            "type_01_normalbutton_046.tga","type_01_normalbutton_047.tga","type_01_normalbutton_048.tga","type_01_normalbutton_049.tga","type_01_normalbutton_050.tga",
            "type_01_normalbutton_051.tga","type_01_normalbutton_052.tga","type_01_normalbutton_053.tga","type_01_normalbutton_054.tga","type_01_normalbutton_055.tga",
            "type_01_normalbutton_056.tga","type_01_normalbutton_057.tga","type_01_normalbutton_058.tga","type_01_normalbutton_059.tga","type_01_normalbutton_060.tga",
        };


        //======================================================================
        public PianoKeyNormal()
        {
            foreach (string fp in ImgTable)
                TexMgr.LoadTextureEx(PathMgr.Img + fp);

            ChangeImage(0);
            Rectangle rect = TexMgr.GetTextureInfo(ImgTable[0]).rectange;
            SetSize(rect.Width, rect.Height);
        }
        //======================================================================
        public void ChangeImage(int num)
        {
            if (num < ImgTable.Length && num >= 0)
                TextureIndex = TexMgr.GetTextureInfo(ImgTable[num]).Index;
            else
                Debug.WriteLine("PianoKeyNormal Chage Image Num Error:" + num);
        }
        //======================================================================
        public void DispRate(float Per)
        {
            int Num = 0;
            if (Per >= 0)
                Num = (int)((float)(ImgTable.Length - 1) * Per);
            else
                Debug.WriteLine("DispRate Per Error:" + Per);

            ChangeImage(Num);
        }
        //======================================================================
    }
}
